import React, { Component } from 'react';
import {
    View,
    Text,
    TouchableOpacity,
} from 'react-native';

import { Tradelist_style as styles } from '../../../../../styles';


export default class Trade_in extends Component {

    constructor(props) {
        super(props);
        this.state = { kg: false }
    };

    render() {
        return (
            <View>
                <TouchableOpacity style={styles.sal_in} activeOpacity={1} onPress={() => { this.aaa() }}>
                    {this.state.kg ?
                        <Text style={styles.sal_text2}>{this.props.rowData}</Text>
                        :
                        <Text style={styles.sal_text1}>{this.props.rowData}</Text>
                    }
                </TouchableOpacity>
            </View>
        )
    }

    aaa() {
        if (this.state.kg) {
            this.props.delefields(this.props.rowData);
        } else {
            this.props.addfields(this.props.rowData);
        }
        this.setState({
            kg: !this.state.kg
        })
    }
}